package com.openness.spider.test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.hadoop.hbase.client.Put;

import com.openness.spider.SpiderConfig;
import com.openness.spider.Url;
import com.openness.spider.commons.Statics;
import com.openness.spider.hbase.HBaseTablePool;
import com.openness.spider.hbase.HBaseUtil;

/**
 * @author Rain
 * @version 2013-6-20 下午3:21:49
 */

public class WorkqueueInitialize {

	public static void main(String[] args) throws IOException {
		List<String> urls = new ArrayList<String>();

		// sina
		urls.add("http://news.sina.com.cn/");
		urls.add("http://finance.sina.com.cn/");
		urls.add("http://tech.sina.com.cn/");

		// qq
		urls.add("http://news.qq.com/");
		urls.add("http://finance.qq.com/");
		urls.add("http://tech.qq.com/");

		// sohu
		urls.add("http://news.sohu.com/");
		urls.add("http://business.sohu.com/");
		urls.add("http://it.sohu.com/");

		// 163
		urls.add("http://news.163.com/");
		urls.add("http://money.163.com/");
		urls.add("http://tech.163.com/");

		List<Put> puts = new ArrayList<Put>();

		for (String url : urls) {
			Url url2 = new Url(url);

			puts.add(url2.put());
		}

		HBaseTablePool.initialize(new SpiderConfig());

		HBaseUtil.put(Statics.HBASE_TABLE_WORKQUEUE, puts);

		HBaseTablePool.shutdown();
	}

}
